package com.example.demofdfs.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import com.example.demofdfs.model.UserLog;

@Component
@Lazy(true)
public class DeleteLogState implements LogState {

	@Autowired
	private LogContext logContext;
	
	public DeleteLogState(LogContext logContext) {
		super();
		this.logContext = logContext;
	}

	@Override
	public Object handle(ProceedingJoinPoint point) throws Throwable {
		
		logContext.insertLog(new UserLog());
		return point.proceed();
	}

}
